home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1996-01-17 | 3.3 KB | 125 lines |
- ' ************************************* Commands used:
- ' * * Vec Rot Pos Turbo Draw
- ' * Amcaf Examples * Vec Rot Angles Blitter Clear
- ' * Vector Rotate Wire + Rubber V1.1 * Vec Rot Precalc =Qsin
- ' * Written by Chris Hodges * =Vec Rot X Set Rain Colour
- ' * * =Vec Rot Y
- ' ************************************* =Vec Rot Z
- '
- ' Remove the mouse pointer
- Hide
- ' Setup a nice little 2 colours screen with double buffering.
- Screen Open 0,320,256,2,Lowres
- Curs Off : Flash Off : Paper 0 : Pen 1 : Cls
- Palette 0,$FFF
- Double Buffer
- Autoback 0
- ' Set up the rainbow, which is used to create the rubber line effect.
- Set Rainbow 0,1,128,"","",""
- ' Trick to modify the scroll register instead of a colour register.
- Extension_8_1330 0,-63
- ' Fill in some sine values.
- For A=0 To 127
- B= Extension_8_1106(A*8,7)+7
- Rain(0,A)=B+B*16
- Next
- ' Read out, how many coords are used.
- Restore COORDS
- Read NUMCO
- ' Dim one field to keep these coords, and a second for the rotated.
- Dim CO(NUMCO,2),RC(NUMCO,1)
- ' Now read all coords in.
- For A=1 To NUMCO
- Read CO(A,0),CO(A,1),CO(A,2)
- Next
- ' Then, get the number of lines the object consists of.
- Restore LINES
- Read NUMLI
- ' Dim a field to hold the startcoord and the endcoord.
- Dim LI(NUMLI,1)
- ' Get the datas.
- For A=1 To NUMLI
- Read LI(A,0),LI(A,1)
- Next
- ' Set the three angles. Remember that these are non standard angles,
- ' one full rotation is at 1024, not 360!
- AX=0 : AY=512 : AZ=128
- ' RP holds the position of the rainbow.
- RP=0
- Repeat
- ' Move the rainbow
- Add RP,1
- Rainbow 0,RP mod 128,Y Hard(-1),259
- ' Clear the screen.
- Extension_8_121C 0,0
- ' While the blitter is working, use the time to calculate the rotations.
- ' Move and set the angles.
- Add AX,5
- Add AY,8
- Add AZ,9
- Extension_8_1138 AX,AY,AZ
- ' Calculate the distances by using a sine-function and the three angles.
- POSX= Extension_8_1106(AX,300)
- POSY= Extension_8_1106(AY,300)
- POSZ= Extension_8_1106(AZ,250)+1000
- ' Set the camera positions.
- Extension_8_1122 POSX,POSY,POSZ
- ' Now it's time to compute the matrix.
- Extension_8_1152
- ' So let's rotate all coordinates of the field CO()
- For A=1 To NUMCO
- ' Note: You only have to use the vec rot function with parameters once.
- RC(A,0)= Extension_8_1168(CO(A,0),CO(A,1),CO(A,2))+160
- RC(A,1)= Extension_8_1184 +128
- Next
- ' It's time to finally get the lines to the screen!
- For A=1 To NUMLI
- ' Starting coordinates pair.
- C1=LI(A,0)
- ' Ending coordinates pair.
- C2=LI(A,1)
- ' Get the rotated coordinates
- X1=RC(C1,0) : Y1=RC(C1,1)
- X2=RC(C2,0) : Y2=RC(C2,1)
- Extension_8_1016 X1,Y1 To X2,Y2,1
- Next
- ' Swap the screens to bring the object to view.
- Screen Swap
- Wait Vbl
- Until Inkey$=Chr$(27) or Mouse Key<>0
- Screen Close 0
- Rainbow Del : View : Wait Vbl
- End
- ' 1_____2
- ' 5/____/|
- ' | | |6|
- ' |4|__|_|3
- ' |/___|/
- ' 8 7
- COORDS:
- Data 8
- ' CUBE
- Data -100,-100,-100
- Data 100,-100,-100
- Data 100,-100,100
- Data -100,-100,100
- Data -100,100,-100
- Data 100,100,-100
- Data 100,100,100
- Data -100,100,100
-
- LINES:
- Data 12
- ' CUBE
- Data 1,2
- Data 2,3
- Data 3,4
- Data 4,1
- Data 5,6
- Data 6,7
- Data 7,8
- Data 8,5
- Data 1,5
- Data 2,6
- Data 3,7
- Data 4,8